import { Component, OnInit } from '@angular/core';
import { HeroService } from '../../../../services/hero.service';
import { NzModalService } from 'ng-zorro-antd';

@Component({
  selector: 'app-maintlog',
  templateUrl: './maintlog.component.html',
  styleUrls: ['./maintlog.component.css']
})
export class MaintlogComponent implements OnInit {

  loading = true;
  isVisible = false;
  btn_loading=false;
  public moduleType:string='';
  public oprateType:string='';
  public name:string='';
  public msg:string='';
  public userName:string='';
  public loglist:Array<any>=[];
  public loginfo:Array<any>=[];
  public PageIndex:number=1;
  public PageSize:number=10;
  public PageTotal:number;
  constructor(private heroService: HeroService,
              private modalService: NzModalService) { }

  ngOnInit() {
    this.getLoglist();
  }

  //获取日志列表数据
  getLoglist(){
    this.btn_loading=true;
    let url=host+"/main/sysLogMaint/list";
    let model="moduleTypeLike="+this.moduleType+"&oprateTypeLike="+this.oprateType+"&nameLike="+this.name+"&msgLike="+this.msg+"&userNameVague="+this.userName+"&page="+this.PageIndex+"&pageSize="+this.PageSize;
    this.heroService.post(url,model).then(result=>{
      this.btn_loading=false;
      if(result.code==0){
        this.loglist=result.data.pageBean.result;
        this.loginfo=result.data.admin;
        this.PageIndex=result.data.pageBean.curPage;  
        this.PageTotal=result.data.pageBean.totalRow;
        this.loading=false;
      }else{
        this.modalService.error({
          nzTitle: '提示',
          nzContent: result.msg
        });
      }
    })
  }

  //分页
  PageIndexChange(event){
    this.PageIndex=event;
    this.getLoglist();
  }
}


